/*
 *	ApOS (Another Project software for s3c2410)
 *	
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License version 2 as
 *	published by the Free Software Foundation.
 *			
 *
 */
#ifndef _TIMER_H
#define _TIMER_H

#define TIMER_0 	0
#define TIMER_1 	1
#define TIMER_2 	2
#define TIMER_3 	3
#define TIMER_4 	4

#define MUX_1_2		0x00
#define MUX_1_4		0x01
#define MUX_1_8 	0x02
#define MUX_1_16	0x03
#define MUX_EXT_TCLK0 	0x04
#define MUX_EXT_TCLK1 	0x04

#define INTERRUPT_MODE	0x00
#define TIMER0_DMA_MODE 0x01
#define TIMER1_DMA_MODE 0x02
#define TIMER2_DMA_MODE 0x03
#define TIMER3_DMA_MODE 0x04
#define TIMER4_DMA_MODE 0x05
#define RESERVED_MODE 	0x06

#define AUTO_RELOAD	1
#define ONE_SHORT	0

#define PRESCALER0_OFFSET_TCFG0 0
#define PRESCALER1_OFFSET_TCFG0 8

#define MUX_BITS_TCFG1 4
#define DMA_MODE_OFFSET_TCFG1	20

#define TIMER0_UPDATE_BIT_TCON	1
#define TIMER1_UPDATE_BIT_TCON	9
#define TIMER2_UPDATE_BIT_TCON	13
#define TIMER3_UPDATE_BIT_TCON	17
#define TIMER4_UPDATE_BIT_TCON	21

#define TIMER0_LOADMODE_BIT_TCON	3
#define TIMER1_LOADMODE_BIT_TCON	11
#define TIMER2_LOADMODE_BIT_TCON	15
#define TIMER3_LOADMODE_BIT_TCON	19
#define TIMER4_LOADMODE_BIT_TCON	22

#define TIMER0_START_BIT_TCON	0
#define TIMER1_START_BIT_TCON	8
#define TIMER2_START_BIT_TCON	12
#define TIMER3_START_BIT_TCON	16
#define TIMER4_START_BIT_TCON	20

struct timer_ctrl_object
{
	volatile unsigned int	*tcfg0;
	volatile unsigned int	*tcfg1;
	volatile unsigned int	*tcon;
	
	volatile unsigned int	*tcntb0;
	volatile unsigned int	*tcmpb0;
	volatile unsigned int	*tcnto0;
	
	volatile unsigned int	*tcntb1;
	volatile unsigned int	*tcmpb1;
	volatile unsigned int	*tcnto1;
	
	volatile unsigned int	*tcntb2;
	volatile unsigned int	*tcmpb2;
	volatile unsigned int	*tcnto2;
	
	volatile unsigned int	*tcntb3;
	volatile unsigned int	*tcmpb3;
	volatile unsigned int	*tcnto3;
	
	volatile unsigned int	*tcntb4;
	volatile unsigned int	*tcnto4;
	
	unsigned int timer_cnt0;
	unsigned int timer_cnt1;
	unsigned int timer_cnt2;
	unsigned int timer_cnt3;
	unsigned int timer_cnt4;			

};



#endif

